<%--
  ~ Copyright (c) 2009.
  ~ nick@tmro.net
  --%>
<!--
Created by IntelliJ IDEA.
User: nick
Date: Apr 5, 2009
Time: 10:01:23 PM
To change this template use File | Settings | File Templates.
-->
<%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Store List</title>
</head>
<body>
<f:view>
    <h1>Store List</h1>
    <h:form>
        <h:dataTable value='#{store.allEntities}' var='item' border="1" cellpadding="2" cellspacing="0">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="name"/>
                </f:facet>
                <h:inputText rendered="#{item == store.entity}" value="#{store.entity.name}"/>
                <h:outputText rendered="#{item != store.entity}" value="#{item.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="category"/>
                </f:facet>
                <h:selectOneMenu rendered="#{item == store.entity}" value="#{store.entity.category}" title="category">
                    <f:selectItems value="#{category.allEntitiesAsSelectedItems}"/>
                </h:selectOneMenu>
                <h:outputText rendered="#{item != store.entity}" value="#{item.category}"/>
            </h:column>
        </h:dataTable>
        <h:commandButton action="#{store.save}" value="Save"/>
        <h:commandButton action="storeList" value="Cancel"/>
    </h:form>
</f:view>
</body>
</html>
